using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace BossFight
{
    public class EventManager : MonoBehaviour
    {
        public GameObject boss;
        public GameObject bossHpBox;
        public GameObject winTip;

        private bool isFirst = true;
        private float bossCurrentHP;
        void Start()
        {
            AudioManager.Instance.PlayBgm(Config.bgm_battle);
        }

        void Update()
        {
            if ( isFirst )
            {
                bossCurrentHP = boss.GetComponent<Boss>().currentHP;
                if (bossCurrentHP <= 0)
                {
                    AudioManager.Instance.StopBgm(Config.bgm_battle);
                    AudioManager.Instance.PlayClip(Config.succeed_music, this.gameObject);

                    bossHpBox.SetActive(false);
                    winTip.SetActive(true);
                    isFirst = false;
                }
            }
        }
    }
}

